package com.entities.projecttask.actionscript;

import com.core.ui.actionscript.ActionScriptParser;
import com.core.utils.GlobalConstants;

public class ActionScriptParserTaskDescription
        extends ActionScriptParser {

	private String taskId = null;



	public void setTaskId ( String value ) {

		taskId = value;
	}



	public String entityIdentifierName () {

		return "id";
	}



	public String parseActionScriptParam ( com.model.KeyValue scriptParam )
	        throws Exception {

		String result = null;
		if ( GlobalConstants.ACTIONSCRIPT_USERINFO_PARAM_KEY.equalsIgnoreCase(scriptParam.getUserInfo()) ) {
			result = String.format("id=%s", this.taskId);
		} else if ( GlobalConstants.ACTIONSCRIPT_USERINFO_PARAM_FORM.equalsIgnoreCase(scriptParam.getKey()) ) {
			result = "EditForm";
		} else {
			result = scriptParam.getValue();
		}
		if ( result == null ) {
			throw new Exception("parseActionScriptParam value == null");
		}
		return result;
	}

}
